package com.atguigu.ssyx.acl.controller;

import com.atguigu.ssyx.common.result.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import java.util.HashMap;
import java.util.Map;

/**
 * Created with IntelliJ IDEA.
 * ClassName: IndexController
 * Package: com.atguigu.ssyx.acl.controller
 * Description:
 * User: fzykd
 *
 * @Author: LQH
 * Date: 2023-09-19
 * Time: 14:59
 */

@Api(tags = "登录接口")
@RestController
@RequestMapping("/admin/acl/index")
 //处理跨域
public class IndexController {


    //登录
    @ApiOperation("登录")
    @PostMapping("/login")
    public Result login() {
        //目前前端只需要返回token值 用map构造一个token
        Map<String, String> token = new HashMap<>();
        token.put("token", "token-admin");
        return Result.ok(token);
    }

    //获取用户信息
    @ApiOperation("获取信息")
    @GetMapping("/info")
    public Result info(){
        Map<String,String> map = new HashMap<>();
        map.put("name","admin");
        map.put("avatar","https://wpimg.wallstcn.com/f778738c-e4f8-4870-b634-56703b4acafe.gif");
        return Result.ok(map);
    }

    //退出
    @ApiOperation("退出")
    @PostMapping("/logout")
    public Result logout(){
        return Result.ok(null);
    }

}
